<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ page contentType="text/html;charset=UTF-8"%>
<jsp:useBean id="pageBean" scope="request" class="com.agileai.hotweb.domain.PageBean"/>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>任务列表</title>
<%@include file="/jsp/inc/resource.inc.jsp"%>
<script language="javascript">
</script>
</head>
<body>
<form action="<%=pageBean.getHandlerURL()%>" name="form1" id="form1" method="post">
  <%@include file="/jsp/inc/message.inc.jsp"%>
  <div id="__ParamBar__" style="float: right;">&nbsp;</div>
<div id="__ToolBar__">
<table border="0" cellpadding="0" cellspacing="1">
<tr>
<td <%=pageBean.inputValue("operationButton")%>  onmouseover="onMover(this);" onmouseout="onMout(this);" class="bartdx" align="center" onclick="enableSave()" ><input value="&nbsp;" type="button" class="editImgBtn" id="modifyImgBtn" title="编辑" />编辑</td>
<td <%=pageBean.inputValue("operationButton")%>  onmouseover="onMover(this);" onmouseout="onMout(this);" class="bartdx" align="center" onclick="saveInfo()"><input value="&nbsp;" type="button" class="saveImgBtn" id="saveImgBtn" title="保存" />保存</td>
<%-- <td <%=pageBean.inputValue("operationButton")%>  onmouseover="onMover(this);" onmouseout="onMout(this);" class="bartdx" align="center" onclick="release();"><input value="&nbsp;" type="button" class="releaseImgBtn" title="返回" />提交</td> --%>
</tr>
</table>
</div>
<table width="100%" class="detailTable" cellspacing="0" cellpadding="0">
<tr>
  <th nowrap>测试方案</th>
  <td width="32%"><input id="PT_NAME" label="PT_NAME" readonly="readonly" name="PT_NAME" type="text" value="<%=pageBean.inputValue("PT_NAME")%>" size="24" class="text" />
    <input id="PT_ID" label="PT_ID" name="PT_ID" type="hidden" value="<%=pageBean.inputValue("PT_ID")%>" size="22" class="text" /></td>
  <th width="18%">所属功能</th>
  <td width="32%"><%-- <select id="PF_ID" label="所属功能" name="PF_ID" class="select" ><%=pageBean.selectValue("PF_ID")%> </select> --%>
    <input id="PF_ID_NAME" name="PF_ID_NAME" type="text" value="<%=pageBean.inputValue("PF_ID_NAME")%>" size="21" class="text" readonly="readonly" />
    <input type="hidden" label="所属功能" id="PF_ID" name="PF_ID" value="<%=pageBean.inputValue("PF_ID")%>"/>
    <img id="grpIdSelectImage" src="images/sta.gif" width="16" height="16" onclick="openFunctionBox()"/></td>
</tr>
<tr>
  <th nowrap>优先级</th>
  <td><select id="TPD_PRIORITY" label="优先级" name="TPD_PRIORITY" class="select" >
    <%=pageBean.selectValue("TPD_PRIORITY")%>
  </select></td>
  <th>缺陷类型</th>
  <td><select id="TPD_TYPE" label="缺陷类型" name="TPD_TYPE" class="select" >
    <%=pageBean.selectValue("TPD_TYPE")%>
  </select></td>
</tr>
<tr>
  <th nowrap>缺陷名称</th>
  <td><input id="TPD_NAME" label="缺陷名称" name="TPD_NAME" type="text" value="<%=pageBean.inputValue("TPD_NAME")%>" size="24" class="text" /></td>
  <th>当前状态</th>
  <td><input id="TPD_STATE_NAME" readonly="readonly" label="当前状态" name="TPD_STATE_NAME" type="text" value="<%=pageBean.inputValue("TPD_STATE_NAME")%>" size="24" class="text" /></td>
</tr>
<tr>
  <th width="18%" nowrap>缺陷描述</th>
  <td colspan="3"> 
    <textarea id="TPD_DESC" label="缺陷描述" name="TPD_DESC" cols="80" rows="4" class="textarea"><%=pageBean.inputValue("TPD_DESC")%></textarea>
    </td>
</tr>
<tr>
  <th nowrap ><div style="text-align: center">
    相关附件
    <div></div>
    </p>
    <input type="button" value='添加' <%=pageBean.inputValue("buttonState")%> onclick="openAddResourceRequestBox()" />
    &nbsp;&nbsp;&nbsp;&nbsp;
    <input type="button" value='删除' <%=pageBean.inputValue("buttonState")%> onclick="deleteImg()" />
  </th>
  <td height="127" colspan="3"><div id="showImg_div"></div></td>
  </tr>
<tr>
  <th nowrap="nowrap">测试人员</th>
  <td><input id="TPD_TESTPERSON_ID" label="TPD_TESTPERSON_ID" name="TPD_TESTPERSON_ID"  type="hidden" value="<%=pageBean.inputValue("TPD_TESTPERSON_ID")%>" size="24" class="text" />
    <input readonly="readonly" id="TPD_TESTPERSON_NAME" label="TPD_TESTPERSON_NAME" name="TPD_TESTPERSON_NAME" type="text" value="<%=pageBean.inputValue("TPD_TESTPERSON_NAME")%>" size="24" class="text" /></td>
  <th>提交时间</th>
  <td><input id="TPD_RELEASE_TIME" readonly="readonly" label="TPD_RELEASE_TIME" name="TPD_RELEASE_TIME" type="text" value="<%=pageBean.inputValue("TPD_RELEASE_TIME")%>" size="24" class="text" /></td>
</tr>
<tr>
  <th nowrap="nowrap">处理人员</th>
  <td><input id="TPD_PROPERSON_ID" readonly="readonly" label="TPD_PROPERSON_ID" name="TPD_PROPERSON_ID" type="hidden" value="<%=pageBean.inputValue("TPD_PROPERSON_ID")%>" size="24" class="text" />
    <input id="TPD_PROPERSON_NAME" readonly="readonly" label="TPD_PROPERSON_NAME" name="TPD_PROPERSON_NAME" type="text" value="<%=pageBean.inputValue("TPD_PROPERSON_NAME")%>" size="24" class="text" /></td>
  <th>处理时间</th>
  <td><input id="TPD_PROCESS_TIME" readonly="readonly" label="TPD_PROCESS_TIME" name="TPD_PROCESS_TIME" type="text" value="<%=pageBean.inputTime("TPD_PROCESS_TIME")%>" size="24" class="text" /></td>
</tr>
</table>
<input type="hidden" name="actionType" id="actionType" value=""/>
<input type="hidden" name="RES_ID" id="RES_ID" value=""/>
<input type="hidden" name="operaType" id="operaType" value="<%=pageBean.getOperaType()%>"/>
<input type="hidden" id="TPD_ID" name="TPD_ID" value="<%=pageBean.inputValue("TPD_ID")%>" />
</form>
<script language="javascript">
/* initCalendar('TPD_PROCESS_TIME','%Y-%m-%d %H:%M','TPD_PROCESS_TIMEPicker');
datetimeValidators[0].set("yyyy-MM-dd HH:mm").add("TPD_PROCESS_TIME"); */
initDetailOpertionImage();
requiredValidator.add("TPD_TYPE");
requiredValidator.add("TPD_PRIORITY");
requiredValidator.add("TPD_NAME");
requiredValidator.add("PF_ID");
var addResourceRequestBox;
function openAddResourceRequestBox(){
	var title = "上传图片";
	if (!addResourceRequestBox){
		addResourceRequestBox = new PopupBox('addResourceRequestBox',title,{size:'big',width:'260px',height:'260px',top:'3px'});
	}
	var url = 'index?PictureUploadHandler&BIZ_ID='+$('#TPD_ID').val();
	addResourceRequestBox.sendRequest(url);	
}

function deleteImg(){
	if(!$("#RES_ID").val()){
		jAlert("没有选中图片！")
		return;
	}
	DeleteImgonfirm()
}
function DeleteImgonfirm(){
	jConfirm('确定要删除图片吗？',function(r){
		if(r){
			postRequest('form1',{actionType:'deleteImg',showSplash:true,onComplete:function(responseText){
				hideSplash();
				jAlert("删除成功！","",function(){
					$("#RES_ID").val("");
					showImg();
				})
			}});	
		}
	})
}
function refresh(){
	doSubmit({actionType:'prepareDisplay'});
}
function saveInfo(){
	if(!validate()){
		return;
	}
	postRequest('form1',{actionType:'save',showSplash:true,onComplete:function(responseText){
		hideSplash();
		parent.PopupBox.closeCurrent();
		parent.refresh(); 
	}});	
}
function showImg(){
	postRequest('form1',{actionType:'showImg',showSplash:true,onComplete:function(responseText){
		hideSplash();
		if (responseText!='null'){
			$("#showImg_div").html(responseText)
		} 
	}});	
}
$(function(){
	showImg();
})

var selectedImage;
function selectPicture(imgObj,resId){
	$("#RES_ID").val(resId);
	if (selectedImage){
		selectedImage.css({'border':"0px solid #FFCC66"});
	}
	selectedImage = $(imgObj);
	selectedImage.css({'border':"2px solid #FFCC66"}); 
}

var showPictureBox;
function showPicture(resId){
	parent.showBugImg(resId);
}

function release(){
	if(!validate()){
		return;
	}
	postRequest('form1',{actionType:'release',showSplash:true,onComplete:function(responseText){
		hideSplash();
		if (responseText=='success'){
			jAlert("已提交！","信息提示",function(){
				parent.refresh();
			})
		}else{
			showMessage("提交失败！")
		} 
	}});	
}

var selectFunctionBox;
function openFunctionBox(){
	var handlerId = "TestSelectFunction"; 
	if (!selectFunctionBox){
		selectFunctionBox = new PopupBox('selectFunctionBox','请选择群组',{size:'normal',width:'300',top:'2px'});
	}
	var url = 'index?'+handlerId+'&targetId=PF_ID&targetName=PF_ID_NAME';
	selectFunctionBox.sendRequest(url);
}
</script>
</body>
</html>
<%@include file="/jsp/inc/scripts.inc.jsp"%>
